import React, { Component } from 'react';
import TransferToChild1 from './Child1';
import TransferToChild2 from './Child2';
import TransferToChild3 from './Child3使用contextType';
// 1.导入共享数据
import { glabalData, glabalContext, globalAction } from './common/js/globalData'
// 2.合并state（状态）数据
// 3.结构glabalContext
const { Provider } = glabalContext
class TransferToChildParent extends Component {
  state = {
    ...glabalData,
    ...globalAction(this)
  }
  render () {
    return (<Provider value={this.state}>
      父组件读取role：{this.state.role}
      <div style={{ backgroundColor: 'red' }}>
        <TransferToChild1 footer={<div>footer区域</div>}>
          插槽===========
        </TransferToChild1>
      </div>
      <TransferToChild2 />
      <TransferToChild3 />
    </Provider>);
  }
}

export default TransferToChildParent;